{extend name="base"}
{block name="title"}消息详情{/block}
{block name="head"}
<style>
.tab-content dl dt {width:64px;}
.tab-content dl dd {margin-left:70px;}
.mainbody{padding:0;margin:0;}
textarea {max-width:360px; max-height:65px; width:360px; height:65px;}
</style>
{/block}
{block name="body"}
<body class="mainbody">
<!--内容-->
<!--
{:var_dump($row)}
-->
<div class="tab-content" style="border:1px solid #eee;">
<form>
  <dl>
    <dt>消息标题：</dt>
    <dd>
      <textarea class="input" name="MsgTitle">{$row.MsgTitle|default=''|htmlentities}</textarea>
      <span class="Validform_checktip">* 最长125字</span>
    </dd>
  </dl>
  <dl>
    <dt>消息内容：</dt>
    <dd>
      <textarea class="input" name="MsgContent">{$row.MsgContent|default=''|htmlentities}</textarea>
      <span class="Validform_checktip">* 最长1024字</span>
    </dd>
  </dl>
{eq name="$htmlType" value="1"}
  <dl>
    <dt>消息范围：</dt>
    <dd id="ServerRange">
      <div class="rule-multi-radio">
        <span style="display: none;">
          {foreach name="UserType" item="val"}
          <input type="radio" id="{$key}" name="UserType" value="{$key}"{notempty name="row.UserType"}{eq name="row.UserType" value="$key"} checked{/eq}{/notempty} /><label>{$key}={$val}</label>
          {/foreach}
        </span>
      </div>

      <textarea  class="input" cols="30" rows="20" name="Users" style="margin:5px 0;vertical-align:bottom;display:<?php echo(empty($row['UserType']) ? 'none' : ($row['UserType']>3?'inline-block':'none')) ?>" data-old="{$row.UserType??''}">{$strUsers}</textarea>
      <span class="Validform_checktip">*</span>
    </dd>
  </dl>
{else/}
  <input type="hidden" value="4" name="UserType">
  <input type="hidden" value="{$strUsers}" name="Users">

{/eq}
  <dl>
    <dt>消息类型：</dt>
    <dd id="MsgType">
      <div class="rule-multi-radio">
        <span style="display: none;">
        {foreach name="MsgType" item="val"}
          <input type="radio" id="{$key}" name="MsgType" value="{$key}"{notempty name="row.MsgType"}{eq name="row.MsgType" value="$key"} checked{/eq}{/notempty} /><label>{$key}={$val}</label>
        {/foreach}
        </span>
      </div>
        <span id="GameType" style="margin:5px 0;vertical-align:bottom;display:<?php echo(empty($row['MsgType']) ? 'none' : ($row['MsgType']>=2?'inline-block':'none')) ?>" >
          {volist name="GameType" id="v"}
              {$v}:<input type="text" name="{$key}" class="input small" data-old="{$row[$key]??0}" value="{$row[$key]??0}">
          {/volist}
        </span>
      <span class="Validform_checktip">*</span>
    </dd>
  </dl>
  <dl id="ChannelType">
    <dt>渠道范围：</dt>
    <dd>
      <div class="rule-multi-radio">
        <span style="display: none;">
          <input type="radio" name="channel" value="0" {eq name="$Channels" value="0"} checked{/eq} /><label>0=所有渠道</label>
          {foreach name="CHANNEL" item="val"}
          <input type="radio" name="channel" value="{$val.ID}" {eq name="$Channels" value="$val.ID"} checked{/eq} /><label>{$val.ID}={$val.Name}</label>
          {/foreach}
        </span>
      </div>
      <span class="Validform_checktip">*</span>
    </dd>
  </dl>

  <dl>
    <dt>禁用状态：</dt>
    <dd>
      <div class="rule-single-checkbox">
        <input type="checkbox" name="IsPass" value="1"{notempty name="row.IsPass"}{eq name="row.IsPass" value="1"} checked{/eq}{/notempty} />
      </div>
      <span class="Validform_checktip">* 是否禁用该条公告</span>
    </dd>
  </dl>
  <dl id="isRealTime">
    <dt>启用实时：</dt>
    <dd>
      <div class="rule-single-checkbox">
        <input type="checkbox" name="IsRealTime" value="1"{notempty name="row.IsRealTime"}{eq name="row.IsRealTime" value="1"} checked{/eq}{/notempty} />
      </div>
      <span class="Validform_checktip">* 是否启用实时通知到玩家该条消息</span>
    </dd>
  </dl>
  <dl>
    <dt>开始时间：</dt>
    <dd>
      <input type="text" class="input rule-date-input" id="CreateDate" {literal}onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss', maxDate:'#F{$dp.$D(\'CreateDate\')}'})"{/literal} name="CreateDate" value="{:substr($row.CreateDate??'', 0, 19)}" />
      <span class="Validform_checktip">*</span>
    </dd>
  </dl>
  <dl><dt>创建时间：</dt><dd>{$row.CreateDate??''}</dd></dl>
</form>
</div>
<!--/内容-->
<script>
$(function () {

  var _edit = $("#ServerRange textarea[name='Users']");
  $("#ServerRange input[type='radio']").click(function () {
    var _this = $(this);
    var idx = _this.attr('id');
    if (idx == 1) { // 所有房间
      _edit.hide();
      $("#ChannelType").show();
      $("#isRealTime").show();
      _edit.val(0);
    } else if (idx == 2) {
      _edit.hide();
      $("#isRealTime").hide();
      $("#ChannelType").show();
      _edit.val(1);
    }else if (idx == 3) {
      $("#isRealTime").hide();
      _edit.hide();
      $("#ChannelType").show();
      _edit.val(2);
    } else if (idx == 4) { // 指定UserID
      _edit.show();
      $("#ChannelType").hide();
      $("#isRealTime").show();
      _edit.val(_edit.text());
    }
  });

  var _edit2 = $("#GameType input[type='text']");
  $("#MsgType input[type='radio']").click(function () {
    console.log(_edit2);
    var _this2 = $(this);
    var idx2 = _this2.attr('id');
    console.log("click", idx2);
    if (idx2 == 1) {        // 通知
      $("#GameType").hide();

    } else if (idx2 == 2) { //补偿
      $("#GameType").show();

    }
  });
});
</script>
</body>
{/block}